package com.atstudy.headline.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 用户兴趣标签表
 * @TableName user_interests
 */
@TableName(value ="user_interests")
@Data
public class UserInterests {
    /**
     * 兴趣ID
     */
    @TableId(type = IdType.AUTO)
    private Integer interestId;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 标签ID
     */
    private Integer tagId;

    /**
     * 兴趣得分
     */
    private BigDecimal score;

    /**
     * 最后更新时间
     */
    private Date lastUpdated;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserInterests other = (UserInterests) that;
        return (this.getInterestId() == null ? other.getInterestId() == null : this.getInterestId().equals(other.getInterestId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getTagId() == null ? other.getTagId() == null : this.getTagId().equals(other.getTagId()))
            && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore()))
            && (this.getLastUpdated() == null ? other.getLastUpdated() == null : this.getLastUpdated().equals(other.getLastUpdated()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getInterestId() == null) ? 0 : getInterestId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getTagId() == null) ? 0 : getTagId().hashCode());
        result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode());
        result = prime * result + ((getLastUpdated() == null) ? 0 : getLastUpdated().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", interestId=").append(interestId);
        sb.append(", userId=").append(userId);
        sb.append(", tagId=").append(tagId);
        sb.append(", score=").append(score);
        sb.append(", lastUpdated=").append(lastUpdated);
        sb.append("]");
        return sb.toString();
    }
}